package top.moyinzi.sakura.controller;

import org.apache.log4j.Logger;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author moyin
 * @date 2018/5/6
 */

@RestController
@RequestMapping("/")
public class PublicController {

    @ResponseBody
    @RequestMapping(value = "/hw.action")
    public String helloWorldAction(HttpServletRequest request, @RequestParam(required = false) String data) {
        if (data == null || "".equals(data)) {
            data = "Sakura";
        }
        String msg = "Hello World, " + data + " !<br />   -- v0.0.4 by auto deploy";
        Logger.getLogger(PublicController.class).info(msg);
        return msg;
    }

}
